package com.hb.trade.client.center;

import cn.hutool.json.JSONObject;
import com.hb.core.pojo.center.sys.dto.CascadeQueryDTO;
import com.hb.core.pojo.center.sys.entity.DicCode;
import com.hb.core.pojo.center.sys.entity.DicType;
import com.hb.core.pojo.center.sys.entity.DistrictInfo;
import com.hb.core.pojo.parent.PageResult;
import org.fzzn.core.model.msg.Message;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.Serializable;
import java.util.List;

/**
 * 字典相关Client
 *
 * @author Lix1ang
 * @date 2021-12-1 13:59:40
 */
@FeignClient("hb-center")
public interface DictionaryClient {

    @PostMapping("/dicCode/pageDicCodes")
    Message<PageResult<DicCode>> pageDicCodes(DicCode dicCode);

    @PostMapping("/dicCode/listDicCodes")
    Message<List<DicCode>> listDicCodes(DicCode dicCode);

    @PostMapping("/dicCode/updateDicCode")
    Message<Boolean> updateDicCode(DicCode dicCode);

    @PostMapping("/dicCode/deleteDicCodes")
    Message<Boolean> deleteDicCodes(List<Long> ids);

    /**
     * 根据key值或label值查询字典数据
     *
     * @param keyOrLabel
     * @return
     */
    @PostMapping("/dicCode/findDicData")
    Message<DicCode> findDicData(@RequestParam("keyOrLabel") Serializable keyOrLabel);


    @PostMapping("/dicType/listDicTypes")
    Message<List<DicType>> listDicTypes(DicType dicType);

    @PostMapping("/dicType/pageDicTypes")
    Message<PageResult<DicType>> pageDicTypes(DicType dicType);

    @PostMapping("/dicType/updateDicType")
    Message<Boolean> updateDicType(DicType dicType);

    @PostMapping("/dicType/deleteDicTypes")
    Message<Boolean> deleteDicTypes(List<Long> ids);


    @PostMapping("/districtInfo/listDistricts")
    Message<List<DistrictInfo>> listDistricts(DistrictInfo districtInfo);

    @PostMapping("/districtInfo/districtsById")
    DistrictInfo districtsById(@RequestBody(required=false) String districtId);

    @PostMapping("/districtInfo/pageDistrict")
    Message<PageResult<DistrictInfo>> pageDistrict(DistrictInfo districtInfo);

    @PostMapping("/districtInfo/updateDistrictInfo")
    Message<Boolean> updateDistrictInfo(DistrictInfo districtInfo);

    @PostMapping("/districtInfo/deleteDistrict")
    Message<Boolean> deleteDistrict(DistrictInfo districtInfo);

    @PostMapping("/districtInfo/deleteDistricts")
    Message<Boolean> deleteDistricts(List<Long> districtIds);

    /**
     * 查询指定表的最顶级数据
     *
     * @param topQuery
     * @return
     * @deprecated 方法逻辑有错误
     */
    @Deprecated
    @PostMapping("/common/getTopData")
    Message<JSONObject> getTopData(CascadeQueryDTO topQuery);

    /**
     * 查询指定主键ID的字典数据
     *
     * @param dicCodeId
     * @return
     */
    @PostMapping("/common/getByPrimary")
    Message<DicCode> getByPrimary(@RequestParam("dicCodeId") Long dicCodeId);


    /**
     * 根据类型代码和值查询字典名称
     * @author tian
     * @date 2022-3-1 17:32
     * @param typeCode
     * @param dicLabel
     * @return org.fzzn.core.model.msg.Message<com.hb.core.pojo.center.sys.entity.DicCode>
     */
    @PostMapping("/dicCode/selectDicCodeByTypeCodeAndDicLabel")
    Message<DicCode> selectDicCodeByTypeCodeAndDicLabel(@RequestParam("typeCode")String typeCode, @RequestParam("dicLabel")String dicLabel);
}
